package com.liuzh.deviceinfo.settings;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;
import c.h.a.b0.m;
import c.h.a.b0.o;
import c.h.a.f0.j;
import c.h.a.m0.f;
import c.h.a.m0.h;
import com.liuzh.deviceinfo.base.BaseActivity;
import com.liuzh.deviceinfo.pro.ProActivity;
import com.liuzh.deviceinfo.view.SettingsItemView;
import java.util.Objects;
import java.util.concurrent.RejectedExecutionException;

public class SettingsActivity extends BaseActivity implements OnClickListener {
    public static final /* synthetic */ int q = 0;

    public class a implements com.liuzh.deviceinfo.view.SettingsItemView.a {
    }

    public void onClick(View view) {
        String str = "com.liuzh.deviceinfo";
        String str2;
        switch (view.getId()) {
            case 2131296518:
                startActivity(new Intent(this, DonateActivity.class));
                return;
            case 2131296548:
                str2 = "android.permission.WRITE_EXTERNAL_STORAGE";
                if (c.h.a.e0.a.b(this, str2)) {
                    m q0 = m.q0(this);
                    q0.o0(false);
                    f fVar = new f(this, q0);
                    Handler handler = c.h.a.m0.p.a.a;
                    try {
                        c.h.a.m0.p.a.c.execute(fVar);
                        return;
                    } catch (RejectedExecutionException unused) {
                        return;
                    }
                }
                b.i.b.a.c(this, new String[]{str2}, 1);
                return;
            case 2131296553:
                boolean z = h.a;
                DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
                StringBuilder g = c.b.a.a.a.g("\n\n\n\nMODEL = ");
                g.append(Build.MODEL);
                String str3 = "_";
                g.append(str3);
                g.append(Build.BRAND);
                g.append("\nOS = ");
                c.b.a.a.a.y(g, VERSION.RELEASE, "\nVERSION = ", "v2.4.9.3", str3);
                g.append(164);
                g.append("\nSCREEN  = ");
                g.append(displayMetrics.widthPixels);
                g.append("x");
                g.append(displayMetrics.heightPixels);
                g.append("\nAPP = ");
                g.append(str);
                str2 = g.toString();
                Intent addFlags = new Intent("android.intent.action.SENDTO").setData(Uri.parse("mailto:liuzhodev@gmail.com")).addFlags(268435456);
                if (!TextUtils.isEmpty(str2)) {
                    addFlags.putExtra("android.intent.extra.TEXT", str2);
                }
                try {
                    startActivity(addFlags);
                    return;
                } catch (ActivityNotFoundException unused2) {
                    Toast.makeText(this, 2131689507, 0).show();
                    return;
                }
            case 2131296803:
                h.s(this);
                return;
            case 2131296825:
                h.m(this, str);
                return;
            case 2131296902:
                ProActivity.F(this);
                return;
            default:
                return;
        }
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        z();
        setTitle(2131690339);
        setContentView(2131492898);
        TextView textView = (TextView) findViewById(2131297327);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(getString(2131689568));
        String str = " - ";
        stringBuilder.append(str);
        stringBuilder.append("v2.4.9.3");
        stringBuilder.append(str);
        stringBuilder.append("Huawei");
        textView.setText(stringBuilder.toString());
        findViewById(2131296553).setOnClickListener(this);
        findViewById(2131296825).setOnClickListener(this);
        findViewById(2131296803).setOnClickListener(this);
        findViewById(2131296548).setOnClickListener(this);
        Objects.requireNonNull(j.d);
        findViewById(2131296902).setOnClickListener(this);
        findViewById(2131296457).setVisibility(8);
        findViewById(2131296518).setVisibility(8);
        ((SettingsItemView) findViewById(2131296490)).setSelectListener(new a());
    }

    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (i != 1) {
            return;
        }
        if (c.h.a.e0.a.f(iArr)) {
            m q0 = m.q0(this);
            q0.o0(false);
            f fVar = new f(this, q0);
            Handler handler = c.h.a.m0.p.a.a;
            try {
                c.h.a.m0.p.a.c.execute(fVar);
            } catch (RejectedExecutionException unused) {
            }
        } else if (!c.h.a.e0.a.c(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
            int i2 = o.i0;
            o.r0(o(), 2131690076, 2131689827);
        }
    }
}
